abstraction
Class ReadFile

java.lang.Object
  extended by abstraction.ReadFile

public class ReadFile
extends java.lang.Object

This class is useful to take a service and to read it. Accepted format are pdf, doc, docx, txt, aut and dot. Before reading file is checked and if it is correct it is possible read it otherwise if there is/are error/s these are shown in console reporting line and type error.


Field Summary
(package private) static int errorLine
           
private static java.lang.String filename
           
private static boolean ioError
           
private static java.lang.String typeError
           
 
Constructor Summary
ReadFile()
           
 
Method Summary
private static boolean checkFile(java.lang.String filename, java.lang.String content)
          this method check file's correctness (file parser)
static java.lang.String readFile()
          this method read a right file with anything extension
static void setFileName(java.lang.String fn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

private static java.lang.String filename

typeError

private static java.lang.String typeError

ioError

private static boolean ioError

errorLine

static int errorLine
Constructor Detail

ReadFile

public ReadFile()
Method Detail

setFileName

public static void setFileName(java.lang.String fn)
Parameters:
fn - file's name to assign

checkFile

private static boolean checkFile(java.lang.String filename,
                                 java.lang.String content)
                          throws WrongFileException,
                                 java.io.IOException,
                                 java.lang.NullPointerException
this method check file's correctness (file parser)

Parameters:
filename -
content -
Returns:
a boolean true if document is correct flase otherwise
Throws:
WrongFileException
java.io.IOException
java.lang.Exception - during reading file
java.lang.NullPointerException

readFile

public static java.lang.String readFile()
                                 throws WrongFileException,
                                        java.io.IOException,
                                        java.lang.NoClassDefFoundError,
                                        java.lang.Exception
this method read a right file with anything extension

Returns:
a string with content'file
Throws:
WrongFileException
java.io.IOException
java.lang.Exception - during reading file
java.lang.NoClassDefFoundError